<template>
  <div class="morePush">
    <PushStore :name="name" :pushStores="pushStores"></PushStore>
  </div>
</template>

<script>
import PushStore from '@/components/front/PushStore.vue'
export default {
  components: { PushStore },
  data() {
    return {
      pushStores: '',
      name: '更多商品推存',
      queryInfo:{
      query:'',
      pagenum:1,
      pagesize:15
    },
    }
  },
  created() {
    this.do()
  },
  methods: {
    async do() {
      let figures = await this.$api.sort.getfigures1(this.queryInfo)
      figures.data.data.forEach(item=>{
        item.pics=item.pics?item.pics.split(','):[]
        item.detailPics=item.detailPics?item.detailPics.split(','):[]
           item.manyAttrs.forEach(item => {
                    item.attrVals= item.attrVals?item.attrVals.split(' '):[]
                    item.addPrice=item.addPrice?item.addPrice.split(' '):[]
                    item.urls= item.urls?item.urls.split(' '):[]
                    item.checkeds=item.checkeds?item.checkeds.split(' ').map(val => val === 'true'):[]
            })
          
            if(item.pics.length>0){
              const img=[]
              item.pics.forEach(item => {
              this.$api.rear_end.download(item).then(res=>{
              let url=window.URL.createObjectURL(new Blob([res.data], { type: 'image/jpeg' }))
              img.push(url)  
           })
     })
     item.pics=img
            }
      })
      //商品信息
      this.pushStores = figures.data.data
    },
  },
}
</script>

<style scoped>
.morePush {
  width: 1170px;
  background-color: #ffffff;
  border-radius: 20px;
  margin-top: 40px;
  margin-left: 20px;
  overflow: hidden;
}
</style>
